﻿using DevExpress.Blazor;
using DevExpress.ExpressApp.Blazor.Editors.Models;
using Microsoft.AspNetCore.Components;
using System.ComponentModel;

namespace EasyXaf.TreeListEditors.Blazor;

public class TreeListModel : DxGridModel
{
    public string ParentKeyFieldName
    {
        get => GetPropertyValue<string>();
        set => SetPropertyValue(value);
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public bool Has_ParentKeyFieldName => HasPropertyValue(nameof(ParentKeyFieldName));

    public string ChildrenFieldName
    {
        get => GetPropertyValue<string>();
        set => SetPropertyValue(value);
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public bool Has_ChildrenFieldName => HasPropertyValue(nameof(ChildrenFieldName));

    public new EventCallback<TreeListFocusedRowChangedEventArgs> FocusedRowChanged
    {
        get => GetPropertyValue<EventCallback<TreeListFocusedRowChangedEventArgs>>(propertyName: "TreeListFocusedRowChanged");
        set => SetPropertyValue(value, propertyName: "TreeListFocusedRowChanged");
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public new bool Has_FocusedRowChanged => HasPropertyValue("TreeListFocusedRowChanged");

    public new EventCallback<TreeListRowClickEventArgs> RowClick
    {
        get => GetPropertyValue<EventCallback<TreeListRowClickEventArgs>>(propertyName: "TreeListRowClick");
        set => SetPropertyValue(value, propertyName: "TreeListRowClick");
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public new bool Has_RowClick => HasPropertyValue("TreeListRowClick");

    public new EventCallback<TreeListRowClickEventArgs> RowDoubleClick
    {
        get => GetPropertyValue<EventCallback<TreeListRowClickEventArgs>>(propertyName: "TreeListRowDoubleClick");
        set => SetPropertyValue(value, propertyName: "TreeListRowDoubleClick");
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public new bool Has_RowDoubleClick => HasPropertyValue("TreeListRowDoubleClick");

    public new EventCallback<TreeListFilterCriteriaChangedEventArgs> FilterCriteriaChanged
    {
        get => GetPropertyValue<EventCallback<TreeListFilterCriteriaChangedEventArgs>>(propertyName: "TreeListFilterCriteriaChanged");
        set => SetPropertyValue(value, propertyName: "TreeListFilterCriteriaChanged");
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public new bool Has_FilterCriteriaChanged => HasPropertyValue("TreeListFilterCriteriaChanged");

    public new Action<TreeListCustomizeElementEventArgs> CustomizeElement
    {
        get => GetPropertyValue<Action<TreeListCustomizeElementEventArgs>>(propertyName: "TreeListCustomizeElement");
        set => SetPropertyValue(value, propertyName: "TreeListCustomizeElement");
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public new bool Has_CustomizeElement => HasPropertyValue("TreeListCustomizeElement");

    public override Type ComponentType => typeof(DxTreeList);
}
